package com.lhkj.ct.meta.admin.model.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.lhkj.ct.base.enums.DeleteStatus;
import com.lhkj.ct.base.enums.GlobalStatus;
import com.lhkj.ct.base.model.IBaseTree;
import com.lhkj.ct.base.validator.group.ValGroups;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 机构表
 * </p>
 *
 * @author jobob
 * @since 2023-09-12
 */
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="TblOrgan对象", description="机构表")
@TableName("tbl_organ")
public class TblOrgan implements IBaseTree<String>, Serializable {

    private static final long serialVersionUID = 1L;

    @NotBlank(message = "机构id不能为空", groups = {ValGroups.Update.class})
    @ApiModelProperty(value = "机构id")
    private String id;

    @NotBlank(message = "父机构id不能为空", groups = {ValGroups.Insert.class, ValGroups.Update.class})
    @ApiModelProperty(value = "父机构id", notes = "顶级机构为0")
    private String parentId;

    @NotBlank(message = "机构编码不能为空", groups = {ValGroups.Insert.class, ValGroups.Update.class})
    @Length(max = 50, message = "机构编号不能超过{max}字符", groups = {ValGroups.Insert.class, ValGroups.Update.class})
    @ApiModelProperty(value = "机构编码")
    private String organCode;

    @NotBlank(message = "机构编码不能为空", groups = {ValGroups.Insert.class, ValGroups.Update.class})
    @Length(max = 100, message = "机构名称不能超过{max}字符", groups = {ValGroups.Insert.class, ValGroups.Update.class})
    @ApiModelProperty(value = "机构名称")
    private String organName;

    @Length(max = 255, message = "机构英文名称不能超过{max}字符", groups = {ValGroups.Insert.class, ValGroups.Update.class})
    @ApiModelProperty(value = "机构英文名称")
    private String organEnName;

    @Length(max = 100, message = "机构简称不能超过{max}字符", groups = {ValGroups.Insert.class, ValGroups.Update.class})
    @ApiModelProperty(value = "机构简称")
    private String organAbbrName;

    @Length(max = 100, message = "机构五笔简码不能超过{max}字符", groups = {ValGroups.Insert.class, ValGroups.Update.class})
    @ApiModelProperty(value = "拼音简码")
    private String pyCode;

    @Length(max = 100, message = "机构五笔简码不能超过{max}字符", groups = {ValGroups.Insert.class, ValGroups.Update.class})
    @ApiModelProperty(value = "五笔简码")
    private String wbCode;

    @Length(max = 30, message = "机构办公电话不能超过{max}字符", groups = {ValGroups.Insert.class, ValGroups.Update.class})
    @ApiModelProperty(value = "办公电话")
    private String officePhone;

    @Length(max = 255, message = "机构地址不能超过{max}字符", groups = {ValGroups.Insert.class, ValGroups.Update.class})
    @ApiModelProperty(value = "机构地址")
    private String organAddress;

    @NotNull(message = "请输入机构排序")
    @ApiModelProperty(value = "排序")
    private Integer sort;

    @Length(max = 255, message = "机构备注不能超过{max}字符", groups = {ValGroups.Insert.class, ValGroups.Update.class})
    @ApiModelProperty(value = "备注")
    private String remark;

    @NotNull(message = "请选择机构状态", groups = {ValGroups.Insert.class, ValGroups.Update.class})
    @ApiModelProperty(value = "机构状态")
    private GlobalStatus status;

    @ApiModelProperty(value = "父节点id路径")
    private String treePath;

    @TableField(fill = FieldFill.INSERT)
    @ApiModelProperty(value = "创建人")
    private String createBy;

    @TableField(fill = FieldFill.INSERT)
    @ApiModelProperty(value = "创建时间")
    private LocalDateTime createTime;

    @TableField(fill = FieldFill.UPDATE)
    @ApiModelProperty(value = "修改人")
    private String updateBy;

    @TableField(fill = FieldFill.UPDATE)
    @ApiModelProperty(value = "修改时间")
    private LocalDateTime updateTime;

    @TableLogic
    @TableField(fill = FieldFill.INSERT)
    @ApiModelProperty(value = "删除状态", notes = "0.未删除 1.已删除")
    private DeleteStatus delFlag;
}
